package com.wangyg.juc.ProducerConsumer.version3;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;

/**
 * Created by wangyg6 on 2018/7/11.
 */
public class Main {
	public static final ReentrantLock lock = new ReentrantLock();
	public static final Condition full = lock.newCondition();
	public static final Condition empty = lock.newCondition();

	public static void main(String[] args) {
		List<String> list = new ArrayList<String>();
		new Thread(new com.wangyg.juc.ProducerConsumer.version3.Producer().setQueue(list),"生产者1").start();
		new Thread(new com.wangyg.juc.ProducerConsumer.version3.Producer().setQueue(list),"生产者2").start();
		new Thread(new com.wangyg.juc.ProducerConsumer.version3.Consumer().setQueue(list),"消费者1").start();
		new Thread(new com.wangyg.juc.ProducerConsumer.version3.Consumer().setQueue(list),"消费者2").start();
		new Thread(new com.wangyg.juc.ProducerConsumer.version3.Consumer().setQueue(list),"消费者3").start();
	}
}
